package joey.project1.view

import java.awt.Graphics
import java.awt.Image

import javax.imageio.ImageIO
import javax.swing.JFrame
import javax.swing.JPanel

class ImagePanel extends JPanel {
	private Image image
	private int width = 100
	private int height = 100

	public ImagePane() {
	}

	public void setImage(File img){
		if(!img || !img.exists())
			return
		try {
			image = ImageIO.read(img);
		} catch (IOException ex) {
			ex.printStackTrace();
		}
	}

	@Override
	protected void paintComponent(Graphics g) {
		super.paintComponent(g);
		if(image!=null){
			g.drawImage(image, 0, 0, width, height, this);
		}
	}
}
